import Vue from 'vue'
import VueRouter from 'vue-router'
import lastIndex from '@/views/lastIndex'
import index from '../views/index'
import frontPage from "@/views/frontPage";
import uploadTopic from "@/views/uploadTopic";
import searchTopic from'@/views/searchTopic';
import showTopic from "@/views/showTopic";
import userCenter from '@/views/userCenter'
import myInfo from '@/views/userCenter-myInfo'
import myCollect from '@/views/userCenter-myCollect'
import myComment from '@/views/userCenter-myComment'
import myNotice from'@/views/userCenter-myNotice'
import manageUser from '@/views/adminUserCenter-manageUser'
import manageDic from '@/views/adminUserCenter-manageDic'
import manageAnnouncement from '@/views/adminUserCenter-manageAnnouncement'
import auditTopic from '@/views/auditorUserCenter-auditTopic'
import login from '@/components/login'
import register from '@/components/register'
import request from '@/utils/request'   //导入utils/request.js文件，这样request.js才生效
import axios from "axios";



Vue.prototype.$axios = axios

Vue.use(VueRouter)

Vue.config.productionTip = false
const routes = [
  /*{
    path: '/',
    name: 'home',
    component: HomeView
  },*/
  {
    path: '/about',
    name: 'about',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/AboutView.vue')
  },
  {
    path:'/lastIndex',
    name:'lastIndex',
    component: lastIndex
  },
  {
    path:'/',
    name:'index',
    component: index,
    children:[
      {
        path:'/userCenter',
        name:'userCenter',
        component: userCenter,
        children:[
          {
            path:'/userCenter/myInfo',
            name:'myInfo',
            component: myInfo
          },
          {
            path:'/userCenter/myCollect',
            name:'myCollect',
            component: myCollect
          },
          {
            path:'/userCenter/myComment',
            name:'myComment',
            component: myComment
          },
          {
            path:'/userCenter/myNotice',
            name:'myNotice',
            component: myNotice
          },
          {
            path:'/adminUserCenter/manageUser',
            name:'manageUser',
            component: manageUser
          },
          {
            path:'/adminUserCenter/manageDic',
            name:'manageDic',
            component: manageDic
          },
          {
            path:'/adminUserCenter/manageAnnouncement',
            name:'manageAnnouncement',
            component: manageAnnouncement
          },
          {
            path:'/auditorUserCenter/auditTopic',
            name:'auditTopic',
            component: auditTopic
          },
        ]
      },
      {
        path:'/index/frontPage',
        name:'frontPage',
        component: frontPage
      },
      {
        path:'/uploadTopic',
        name:'uploadTopic',
        component: uploadTopic
      }
    ]
  },
  {
    path:'/searchTopic',
    name:'searchTopic',
    component: searchTopic
  },
  {
    path:'/showTopic',
    name:'showTopic',
    component: showTopic
  },
  {
    path:'/login',
    name:'login',
    component: login
  },
  {
    path:'/register',
    name:'register',
    component: register
  }

]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router

/*
{
  path:'/register',
      name:'register',
    component: register
}
import register from "@/views/register";*/
